using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace FrameworkDesign
{
    public class IOCContainer
    {
        private Dictionary<Type, object> mInstance = new Dictionary<Type, object>();
        public void Register<T>(T paramete) 
        {
            var key = typeof(T);
            if (mInstance.ContainsKey(key))
            {
                mInstance[key] = paramete;
            }
            else
            {
                mInstance.Add(key, paramete);
            }
        }
        public T Get<T>() where T : class
        {
            var key = typeof(T);
            object value = default(object);
            if (mInstance.TryGetValue(key,out value))
            {
                return (T)value;
            }
            return null;
        }
    }
}

